/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ssau.utils;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import ru.ssau.entities.AuthorizationInfoLocalHome;
import ru.ssau.entities.MessageLocalHome;
import ru.ssau.entities.ThreadLocalHome;
import ru.ssau.entities.UserLocalHome;


public class EntityUtil {

    private EntityUtil() {
        
    }

    public static ThreadLocalHome getThreadLocalHome() throws NamingException {
        Context namingContext = new InitialContext();
        return (ThreadLocalHome) namingContext.lookup("java:comp/env/ejb/ThreadBean");
    }

    public static MessageLocalHome getMessageLocalHome() throws NamingException {
        Context namingContext = new InitialContext();
        return (MessageLocalHome) namingContext.lookup("java:comp/env/ejb/MessageBean");
    }

    public static UserLocalHome getUserLocalHome() throws NamingException {
        Context namingContext = new InitialContext();
        return (UserLocalHome) namingContext.lookup("java:comp/env/ejb/UserBean");
    }

    public static AuthorizationInfoLocalHome getAuthorizationInfoLocalHome() throws NamingException {
        Context namingContext = new InitialContext();
        return (AuthorizationInfoLocalHome) namingContext.lookup("java:comp/env/ejb/AuthorizationInfoBean");
    }

}
